<pre class="docs-method-signature"><code>curve.length([opt])</code></pre>
<p>Return the length of the curve.</p>

<p>The curve length is a flattened length. This means that there will always be a difference between the reported length and the real length of the curve. (The returned curve length is always lower than the actual curve length.) That being said, the observed error can be constrained to an arbitrary threshold - here determined by <code>opt.precision</code>.</p>

<p>The <code>opt.precision</code> property is logarithmic, which means that increasing precision by 1 decreases observed error in length by a factor of 10. (For example, precision 3 leads to an observed error of less than 0.1%, precision 4 guarantees an observed error of less than 0.01%, etc.)</p>

<p>The default value for <code>opt.precision</code> is 3; this corresponds to maximum observed error of 0.1%.</p>

<p>As a rule of thumb, increasing precision by 1 quadruples the number of operations needed to determine the length; exact numbers vary for every individual curve, however. Precision 3 is considered good enough when drawing curve approximations, and precision 4 is considered good enough for mapping curve <code>t</code> values to curve length. (Precision 4 should be the highest necessary for any practical use.)</p>

<p>The measure used, observed error (difference between subsequent observed lengths), is not a measure of actual error (difference between observed length and the actual length); it is a necessary substitution, however. The actual curve length cannot be precisely determined in the general case, and obtaining flattened length at maximum precision is not feasible for every single length calculation. Still, actual error is generally 2-3 times lower than observed error, so <code>opt.precision</code> can be seen as an upper bound on the length error with a high degree of confidence.</p>

<p>Instead of <code>opt.precision</code>, the <code>opt.subdivisions</code> property may be specified, directly providing an array of pre-computed curve subdivisions from which to calculate curve length. This is useful when several operations need to be performed with the same curve at the same level of precision (for example, obtaining the length of the curve and then finding the point at 10% length). Use the <code>curve.getSubdivisions()</code> <a href="#g.Curve.prototype.getSubdivisions">function</a> to obtain an array of curve subdivisions.</p>
